home *** CD-ROM | disk | FTP | other *** search
/ Mastering Web Site Development / Microsoft Mastering Web Site Development (Microsoft) (1997).iso / Labs / StateUFinal / profile.asp < prev    next >
Text File  |  1997-04-24  |  3KB  |  118 lines

  1. <%@ LANGUAGE="VBSCRIPT" %>
  2. <%
  3. If Not (IsEmpty(Request("txtID"))) Then
  4.     'request came from Submit button on form
  5.     Session("username") = Request("txtName")
  6.     Session("id") = Request("txtID")
  7.     Session("major") = Request("Major")
  8.  
  9.     If InStr(Session("requestedPage"), "profile") = 0 Then
  10.         response.redirect Session("requestedPage")
  11.     Else
  12.         response.redirect "default.htm"
  13.     End If
  14. End If
  15. %>
  16. <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
  17. <html>
  18.  
  19. <head>
  20. <meta http-equiv="Content-Type"
  21. content="text/html; charset=iso-8859-1">
  22. <meta name="GENERATOR"
  23. content="Microsoft FrontPage (Visual InterDev Edition) 2.0">
  24. <title>User Profile</title>
  25. <link rel="STYLESHEET" href="Stylesheets/Grid/Style2.css">
  26.  
  27. <SCRIPT language=vbscript>
  28. Sub Window_OnLoad()
  29.     Document.frmProfile.lstMajors.AddItem "Math"
  30.     Document.frmProfile.lstMajors.AddItem "Music"
  31.     Document.frmProfile.lstMajors.AddItem "History"
  32. End Sub
  33. Sub Submit_OnClick()
  34.    If IsNumeric(Document.frmProfile.txtID.Value) Then
  35.     If Document.frmProfile.txtID.Value >= 1 AND _
  36.        Document.frmProfile.txtID.Value <= 57 Then
  37.         'save the value of the combo box in the hidden control
  38.        frmProfile.Major.Value = frmProfile.lstMajors.Text
  39.        'submit the form data to the server
  40.        Document.frmProfile.Submit
  41.      Else
  42.        MsgBox "ID must be between 1 and 57."
  43.     End If
  44.    Else
  45.     MsgBox "ID must be numeric."
  46.    End If
  47. End Sub
  48.  
  49. </SCRIPT>
  50. </head>
  51.  
  52. <body background="Images/Grid/Background/Back2.jpg"
  53. bgcolor="White">
  54. <basefont face="Arial, Helvetica, sans-serif">
  55.  
  56. <!-- Page Header -->
  57. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  58.     <tr>
  59.         <th align="Left" nowrap bgcolor="Silver"
  60.         background="./Images/Grid/Navigation/Nav1.jpg"> <font
  61.         size="6"> Student Profile </font> </th>
  62.     </tr>
  63.     <tr>
  64.         <td bgcolor="#FFFFCC"> <font size="-1">  
  65.         Enter your Student ID, Name, and preferred Major </font> </td>
  66.     </tr>
  67. </table>
  68. <!-- end of page header -->
  69.  
  70. <P>
  71. <%
  72. If Not (IsEmpty(Request("txtID"))) Then
  73.     'request came from Submit button on form
  74.     username = Request("txtName")
  75.     id= Request("txtID")
  76.     major = Request("Major")
  77. %>
  78. Welcome, <%=username%>, to State University.
  79. <P>I see you are interested in <%=major%>.    
  80. <% End If %>
  81. <P>
  82. <form NAME=frmProfile ACTION=profile.asp METHOD=Post>
  83.     <div align="left">
  84.     <table border="0" cellpadding="2">
  85.         <tr>
  86.             <td>ID</td>
  87.             <td><input type="text" size="20" name="txtID"></td>
  88.         </tr>
  89.         <tr>
  90.             <td>Name </td>
  91.             <td><input type="text" size="20" name="txtName"></td>
  92.         </tr>
  93.         <tr>
  94.             <td>Major </td>
  95.             <td><OBJECT ID="lstMajors" WIDTH=140 HEIGHT=24
  96.         CLASSID="CLSID:8BD21D30-EC42-11CE-9E0D-00AA006002F3">
  97.     <PARAM NAME="VariousPropertyBits" VALUE="746604571">
  98.     <PARAM NAME="DisplayStyle" VALUE="3">
  99.     <PARAM NAME="Size" VALUE="3704;635">
  100.     <PARAM NAME="MatchEntry" VALUE="1">
  101.     <PARAM NAME="ShowDropButtonWhen" VALUE="2">
  102.     <PARAM NAME="FontCharSet" VALUE="0">
  103.     <PARAM NAME="FontPitchAndFamily" VALUE="2">
  104.     <PARAM NAME="FontWeight" VALUE="0">    
  105.         </OBJECT></td>
  106.         </tr>
  107.         <tr>
  108.             <td> </td>
  109.             <td><input type="button" name="Submit" value="Submit"></td>
  110.         </tr>
  111.     </table>
  112.     </div>
  113.     <INPUT TYPE=HIDDEN NAME=Major Value="">
  114. </form>
  115.  
  116. </body>
  117. </html>
  118.